home *** CD-ROM | disk | FTP | other *** search
/ Mac Easy 2010 May / Mac Life Ubuntu.iso / casper / filesystem.squashfs / usr / share / pyshared / AppInstall / distros / Debian.py < prev    next >
Encoding:
Python Source  |  2009-03-31  |  6.2 KB  |  130 lines

  1. import Default
  2.  
  3. from AppInstall.Menu import SHOW_ALL, SHOW_ONLY_SUPPORTED, SHOW_ONLY_FREE, SHOW_ONLY_MAIN, SHOW_ONLY_PROPRIETARY, SHOW_ONLY_THIRD_PARTY, SHOW_ONLY_INSTALLED
  4.  
  5. from gettext import gettext as _
  6.  
  7. class Distribution(Default.Distribution):
  8.     def __init__(self):
  9.         Default.Distribution.__init__(self)
  10.         # Dictonary of all available filters with corresponding choser name
  11.         # and tooltip
  12.         # The installed filter will be automatically added in non-installer mode
  13.         # The primary and secondary filters are separated
  14.         self.filters_primary = {
  15.             SHOW_ALL : (_("All available applications"),
  16.                         _("Show all applications including ones which are "
  17.                           "possibly restricted by law or copyright")),
  18.             SHOW_ONLY_FREE :(_("All Open Source applications"),
  19.                              _("Show all Debian applications which can be "
  20.                                "freely used, modified and distributed. This "
  21.                                "includes a large variety of community "
  22.                                "maintained applications")),
  23.             }
  24.         self.filters_secondary = {
  25.             SHOW_ONLY_THIRD_PARTY : (_("Third party applications"),
  26.                                      _("Show only applications that are "
  27.                                        "provided by independent software "
  28.                                        "vendors and are not part of Debian"))
  29.             } 
  30.         # List of components whose applications should not be installed
  31.         # before asking for a confirmation
  32.         self.components_ask = ["contrib", "non-free"]
  33.         # Dictonary that provides dialog messages that are shown,
  34.         # before a component gets activated or when it requires to be confirmed
  35.         self.components_activation = {
  36.             # Fallback
  37.             None : [_("Enable the installation of software from the %s "
  38.                       "component of Debian?"),
  39.                     # %s is the name of the component
  40.                     _("%s is not officially supported with security "
  41.                       "updates.")],
  42.             "main" : [_("Enable the installaion of officially "
  43.                         "supported Debian software?"),
  44.                       # %s is the name of the application
  45.                       _("%s is part of the Debian main distribution. "
  46.                         "Debian provides support and security "
  47.                         "updates, which will be enabled too.")],
  48.             "contrib" : [_("Enable the installation of partial free software?"),
  49.                           # %s is the name of the application
  50.                           _("%s is not part of the Debian main distribution "
  51.                             "and requires non-free software to work. "
  52.                             "Debian provides support and security "
  53.                             "updates, which will be enabled too.")],
  54.             "non-free" : [_("Enable the installation of non-free software?"),
  55.                           # %s is the name of the application
  56.                           _("The use, modification and distribution of %s "
  57.                             "is restricted by copyright or by legal terms in "
  58.                             "some countries.")]
  59.               }
  60.  
  61.         self.dependencies_map = [
  62.             # KDE
  63.             (("kdelibs4c2a","python-kde3","libqt3-mt"),
  64.             # %s is the name of an application
  65.              _("%s integrates well into the KDE desktop"), 
  66.              "application-kde"),
  67.             # GNOME
  68.             (("libgnome2-0","python-gnome2","libgtk2.0-0","python-gtk2"),
  69.             # %s is the name of an application
  70.              _("%s integrates well into the GNOME desktop"), 
  71.              "application-gnome"),
  72.             # GNUSTEP
  73.             (("libgnustep-base1.11"),
  74.             # %s is the name of an application
  75.              _("%s integrates well into the Gnustep desktop"), 
  76.              None),
  77.             # XUBUNTU
  78.             (("libxfce4util4",),
  79.             # %s is the name of an application
  80.              _("%s integrates well into the XFCE desktop"),
  81.              None)]
  82.  
  83.         self.comp_depend_map = { "contrib":["main", "non-free"],
  84.                                  "non-free":["main"]}
  85.  
  86.     def get_app_emblems(self, app, cache):
  87.         # A short statement about the freedom, legal status and level of
  88.         # support of the application
  89.         emblems = []
  90.         icon_name = None
  91.         tooltip = None
  92.  
  93.         if app.thirdparty or app.channel:
  94.             tooltip = ("%s is provided by a third party vendor "
  95.                        "and is therefore not an official part "
  96.                        "of Debian. The third party vendor is "
  97.                        "responsible for support and security "
  98.                        "updates.") % app.name
  99.  
  100.             icon_name = "application-proprietary"
  101.             emblems.append((icon_name, tooltip))
  102.         elif app.component == "main":
  103.             tooltip = _("Debian provides support and "
  104.                         "security updates for %s") % app.name
  105.             icon_name = "application-debian-main"
  106.             emblems.append((icon_name, tooltip))
  107.         elif app.component == "contrib":
  108.             tooltip =_("%s requires non-free software to work."
  109.                         "Debian provides support and "
  110.                         "security updates.") % app.name
  111.             icon_name = "application-debian-contrib"
  112.             emblems.append((icon_name, tooltip))
  113.         elif app.component == "non-free":
  114.             tooltip = _("The use, modification and distribution "
  115.                         "of %s is restricted by copyright or by "
  116.                         "legal terms in some countries. "
  117.                         "Debian provides support and "
  118.                         "security updates.") % app.name
  119.             icon_name = "application-debian-non-free"
  120.             emblems.append((icon_name, tooltip))
  121.  
  122.         # Add an emblem corresponding to the dependencies of the app
  123.         if cache.has_key(app.pkgname):
  124.             for (deps, tooltip, icon_name) in self.dependencies_map:
  125.                 for dep in deps:
  126.                     if cache.pkgDependsOn(app.pkgname, dep):
  127.                         emblems.append((icon_name, tooltip % app.name))
  128.                         break
  129.         return emblems
  130.